import logging
import traceback


def catch_wxception(func):
    def wrapper(*args,**kwargs):
        try:
            return func(*args,**kwargs)
        except Exception as e:
            logging.error(f"Error in {func.__name__}: {str(e)}\n{traceback.format_exc()}")
            raise
    return  wrapper